/**
 * meiguang8.com
 * Copyright (C) 2016-2019 All Rights Reserved.
 */
package com.yuanchuang.yp.mall.framework.extend;

import com.yuanchuang.yp.framework.common.exception.BaseException;

import java.text.MessageFormat;

/**
 * class_name: ArgumentsLengthManayException
 * package: com.yuanchuang.yp.mall.framework.extend
 * describe: TODO
 * @author: yuanyuan.zhu
 * creat_date: 2019/7/10
 * creat_time: 19:24
 **/
public class ArgumentsLengthManayException extends BaseException {

    public static ArgumentsLengthManayException argumentsLengthManayException = new ArgumentsLengthManayException("0000","参数长度太长要求是1个");

    /**
     * 异常构造器
     *
     * @param code      代码
     * @param msgFormat 消息模板,内部会用MessageFormat拼接，模板类似：userid={0},message={1},date{2}
     * @param args      具体参数的值
     */
    public ArgumentsLengthManayException(String code, String msgFormat, Object... args) {
        super(code, msgFormat, args);
    }

    /**
     * 实例化异常
     *
     * @param msgFormat
     * @param args
     * @return 异常类
     */
    @Override
    public BaseException newInstance(String msgFormat, Object... args) {
        return new ArgumentsLengthManayException(code,MessageFormat.format(msgFormat,args));
    }

}
